package cn.tedu;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;

//定义配置类，用于显示创建对象
@Configuration
public class ConfigBeans {

    /**
     * 使用@Bean显示创建Java Bean组件
     * 声明Bean对象的方法名就是组件默认ID
     */
    @Bean
    public ArrayList<String> list() {
        ArrayList<String> list = new ArrayList<>();
        list.add("123");
        list.add("456");
        return list;
    }

    @Bean
    public MyBean myBean1(){ //myBean1
        return new MyBean();
    }

    @Bean
    public MyBean myBean2(){
        return new MyBean();
    }



}
